﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Matrix
{
    class  Matrix
    {
        private double[,] M;
        private int N;

        public Matrix(List<string> S, int n)
        {
            N = n;
            M = new double[N,N];
            for(int i = 0; i < N; i++)
            {
                string[] str = S[i].Split(new char[] {' ',','},StringSplitOptions.RemoveEmptyEntries);

                for(int j = 0; j < N; j++)
                {
                    if (str.Length > j)
                        M[i, j] = Convert.ToDouble(str[j]);
                    else M[i, j] = 0;
                }
            }
        }

        public double SumSecondaryDiagonal()
        {
            double Sum=0;
            for (int i = 0; i < N; i++)
            {
                Sum+=M[i,N-i-1];                
            }
            return Sum;
        }
        
    }
}